package com.kwan.widget.indicator;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class ScreenSlidePageAdapter extends FragmentStateAdapter {


	public ScreenSlidePageAdapter(@NonNull FragmentActivity fragmentActivity) {
		super(fragmentActivity);
	}

	public ScreenSlidePageAdapter(@NonNull Fragment fragment) {
		super(fragment);
	}

	public ScreenSlidePageAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
		super(fragmentManager, lifecycle);
	}

	List<NavigatorEntity> fragments;

	public ScreenSlidePageAdapter setFragmentList(List<NavigatorEntity> fragments) {
		this.fragments = fragments;
		return this;
	}

	@NonNull
	@Override
	public Fragment createFragment(int position) {
		return fragments.get(position).getFragment();
	}

	@Override
	public int getItemCount() {
		return fragments.size();
	}
}
